import request from '../network/request'

const Api = {
    twProductMyPage: 'api/biz/twProduct/myPage',
    twProductMyAdd: 'api/biz/twProduct/add',
    twProductMyEdit: 'api/biz/twProduct/edit',
    twProductMyDelete: 'api/biz/twProduct/delete',
    twProductMyDetail: 'api/biz/twProduct/detail',
    twProductSpecProduct: 'api/biz/twProduct/specProduct',
    twProductCollect: 'api/biz/twProduct/collect',
    twProductThCatIdList: 'api/biz/twProduct/thCatIdList',
    twProductEnterprisePage: 'api/biz/twProduct/enterprisePage',
    twProductPageApi: 'api/biz/twProduct/pageApi',
    twProductAudit: 'api/biz/twProduct/audit',

 }

export const twProductAudit=(data) =>{
    return request({
        url: Api.twProductAudit,
        method: 'post',
        data:data,
        headers: {contentType: 'application/json;charset=UTF-8',loading:false}
    })
}

export const twProductCollect=(data) =>{
    return request({
        url: Api.twProductCollect,
        method: 'post',
        data:data,
        headers: {contentType:  'application/x-www-form-urlencoded',loading:true}
    })
}


export const twProductPageApi=(data) =>{
    return request({
        url: Api.twProductPageApi,
        method: 'get',
        data:data,
        headers: {contentType:  'application/x-www-form-urlencoded',loading:false}
    })
}


export const twProductThCatIdList=(data) =>{
    return request({
        url: Api.twProductThCatIdList,
        method: 'get',
        data:data,
        headers: {contentType:  'application/x-www-form-urlencoded',loading:true}
    })
}

export const twProductSubmitForm=(data,add=true) =>{
    return request({
        url: `${add?Api.twProductMyAdd:Api.twProductMyEdit}`,
        method: 'post',
        data:data,
        headers: {contentType: 'application/json;charset=UTF-8',loading:true}
    })
}



export const twProductMyDelete=(id) =>{
    return request({
        url: Api.twProductMyDelete,
        method: 'post',
        data:[{id:id}],
        headers: {contentType: 'application/json;charset=UTF-8',loading:true}
    })
}





export const twProductMyPage=(data) =>{
    return request({
        url: Api.twProductMyPage,
        method: 'get',
        data:data,
        headers: {contentType: 'application/x-www-form-urlencoded',loading:false}
    })
}



export const twProductEnterprisePage=(data) =>{
    return request({
        url: Api.twProductEnterprisePage,
        method: 'get',
        data:data,
        headers: {contentType: 'application/x-www-form-urlencoded',loading:false}
    })
}




export const twProductMyDetail=(id) =>{
    return request({
        url: Api.twProductMyDetail,
        method: 'get',
        data: {id:id},
        headers: {contentType: 'application/x-www-form-urlencoded',loading:false}
    })
}





export const twProductSpecProduct=() =>{
    return request({
        url: Api.twProductSpecProduct,
        method: 'get',
        headers: {contentType: 'application/x-www-form-urlencoded',loading:false}
    })
}



